package com.ssit.answer.service.impl.${packageDir};

import java.util.List;
import javax.annotation.Resource;
import com.ssit.answer.domain.sys.${className};
import com.ssit.answer.dao.sys.${className}Dao;
import com.ssit.answer.dto.page.Page;
import com.ssit.answer.dto.page.PageUtil;
import org.springframework.stereotype.Service;
import com.ssit.answer.service.api.${packageDir}.I${className}Service;

/**
* 描述:<br/>
* ${comment!""}
*
* @author ${author} ${.now?string("yyyy年MM月dd日")}
*/
@Service
public class ${className}ServiceImpl implements I${className}Service{

	@Resource
	${className}Dao ${className?uncap_first}Dao;
	
	/**
	 * 新增信息
	 * 
	 * @param ${className?uncap_first} 对象信息
	 */
	@Override
	public void add${className}(${className} ${className?uncap_first}) {
		 ${className?uncap_first}Dao.insert(${className?uncap_first});		
	}


	/**
	 * 删除信息
	 * 
	 * @param ${className?uncap_first} 对象信息
	 */
	@Override
	public void delete${className}(${className} ${className?uncap_first}) {
		${className?uncap_first}.setDeleteFlag(true);
		${className?uncap_first}Dao.update(${className?uncap_first});		
	}
	
	/**
	 * 修改信息
	 * 
	 * @param ${className?uncap_first} 对象信息
	 */
	@Override
	public void update${className}(${className} ${className?uncap_first}) {
		${className?uncap_first}Dao.update(${className?uncap_first});		
	}
	
	/**
	 * 查找信息
	 * 
	 * @param ${className?uncap_first} 对象信息
	 */
	@Override
	public ${className} find${className}(${className} ${className?uncap_first}) {
		return ${className?uncap_first}Dao.find${className}(${className?uncap_first});		
	}
	
	/**
	 * 查找信息列表
	 * 
	 * @param ${className?uncap_first} 对象信息
	 */
	@Override
	public List<${className}> list${className}(${className} ${className?uncap_first}) {
		return ${className?uncap_first}Dao.list${className}(${className?uncap_first});		
	}
	
	/**
	 * 查找信息分页列表
	 * 
	 * @param ${className?uncap_first} 对象信息
	 */
	@Override
	public Page<${className}> page${className}(${className} ${className?uncap_first}) {
		if(${className?uncap_first}.getPage() == null) {
			${className?uncap_first}.setPage(new Page<${className}>());
		}
		return PageUtil.setItems(${className?uncap_first}.getPage(),${className?uncap_first}Dao.list${className}(${className?uncap_first}));		
	}
	
}